3 # Copyright 2011 Paul Haensch
4 # This file is part of Busy
6 # Busy is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # Busy is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Affero General Public License for more details.
16 # You should have received a copy of the GNU Affero General Public License
17 # along with Busy. If not, see <http://www.gnu.org/licenses/>.
20 alias _wiki="stx2any --no-template --link-abbrevs --quote -T html"
23 page=$(egrep -o '(^|&)p=[a-zA-Z0-9/_-]+(&|$)' <<<"${QUERY_STRING}" |sed 's,&,,g;s,p=,,')
25 [ -z "$LOGIN" ] && LOGIN=false
26 [ -z "$page" ] && page=Home
28 if (! $LOGIN && egrep -qx "https?://${HTTP_HOST}/(session.cgi\?|write/).*" <<<"${HTTP_REFERER}"); then
29 echo -n "Location: https://${HTTP_HOST}/session.cgi?${QUERY_STRING}\n\n"
33 echo -n "Content-type: text/html\n\n"
37 <!-- DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd" -->
41 <title>$(sed -rn 's:^name=(.*)$:\1:p' project.meta) - Busy</title>
42 <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
43 <link rel="stylesheet" type="text/css" href="busy.css">
44 <link rel="stylesheet" type="text/css" href="wikitext.css">
45 $([ -r "${page}.css" ] && echo '<link rel="stylesheet" type="text/css" href="'"$page"'.css">')
46 <style type="text/css"><!-- --></style>
47 <script type="text/javascript">
49 function show_screen(id){
50 document.getElementById(id).style.display = "inline";
52 function hide_screen(id){
53 document.getElementById(id).style.display = "none";
58 <body onload="init();">
60 <h1 id="NAME">$(egrep '^name=.*$' project.meta |cut -d= -f2-)</h1>
61 <span id="SLOGAN">$(egrep '^slogan=.*$' project.meta |cut -d= -f2-)</span>
64 $( $LOGIN || echo '<form action="https://'${HTTP_HOST}'/login.cgi?'${QUERY_STRING:gs/&/&/}'" method="post" accept-charset="UTF-8">
66 <input type="text" name="user" value placeholder="Username"><br>
67 <input type="password" name="pass" value placeholder="Password"><br>
68 <input type="submit" value="Go!">
74 <a href='/?p=Home'>Home</a>
75 <a href='/?p=Wiki'>Wiki</a>
76 <a href='/?p=Subversion'>Code</a>
77 <a href='/?p=Tasks'>Tasks</a>
79 $(if [ -r "./${page}.page" ]; then
82 echo '<h2>Page not found or nevermore</h2>'
83 echo 'Quoth the Raven: 404'